//
//  HZ_hot_CollectionViewCell.m
//  HZ_Beautiful_Music
//
//  Created by dllo on 16/4/1.
//  Copyright © 2016年 ui. All rights reserved.
//

#import "HZ_hot_CollectionViewCell.h"
#import "UIImageView+WebCache.h"
@interface HZ_hot_CollectionViewCell ()


@property (nonatomic, strong) UILabel *Hearlabel;
@property (nonatomic, strong) UILabel *Comelabel;
@property (nonatomic, strong) UILabel *typelabel;
/**
 *  这个属性为歌单属性
 */
@property (nonatomic, strong) UILabel *authorLable;

@property (nonatomic, strong) UIImageView *Pictureimage;
@property (nonatomic, strong) UIImageView *headsetimage;


@end
@implementation HZ_hot_CollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    
    
    self = [super initWithFrame:frame];
    
    if (self) {

//     self.backgroundColor = [UIColor clearColor];
        
        self.Pictureimage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, self.bounds.size.width - 10, self.bounds.size.width - 10)];
        
//        self.Pictureimage.backgroundColor = [UIColor whiteColor];
        
        
        [self.contentView addSubview:self.Pictureimage];
        
        
        
        self.typelabel = [[UILabel alloc] initWithFrame:CGRectMake(5, self.Pictureimage.bounds.size.height + 8, self.Pictureimage.bounds.size.width, self.bounds.size.height - self.Pictureimage.bounds.size.height - 12 )];
        
        
        self.typelabel.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:self.typelabel];
      
        self.Comelabel = [[UILabel alloc] initWithFrame:CGRectMake(10, self.Pictureimage.bounds.size.height - 20, self.Pictureimage.bounds.size.width - 10 , 20)];
        
        self.Comelabel.textColor = [UIColor whiteColor];
//        self.Comelabel.backgroundColor = [UIColor colorWithRed:0.602 green:1.000 blue:0.979 alpha:1.000];
        [self.contentView addSubview:self.Comelabel];
        
        self.headsetimage = [[UIImageView alloc] initWithFrame:CGRectMake(self.Pictureimage.bounds.size.width / 2 + 6, 10, 15, 15)];
        
//        self.headsetimage.backgroundColor = [UIColor colorWithRed:1.000 green:0.430 blue:0.902 alpha:1.000];
        
        self.headsetimage.image = [UIImage imageNamed:@"iconfont-erji"];
        [self.contentView addSubview:self.headsetimage];
        
        self.Hearlabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headsetimage.frame.origin.x + 20, 6, self.Pictureimage.bounds.size.width / 2 - 15, 20)];
        _Hearlabel.font = [UIFont systemFontOfSize:15];
        _Hearlabel.textColor = [UIColor whiteColor];
        [self.contentView addSubview:self.Hearlabel];
        
        /**
         下为歌单列表所需
         
         - returns: <#return value description#>
         */
        self.authorLable = [[UILabel alloc] initWithFrame:CGRectMake(10, self.bounds.size.height - 65, self.bounds.size.width - 20, 25)];
        [self.contentView addSubview:_authorLable];

        
    }

    return self;
}


-(void)setModel:(HS_DataArray_Model *)model{
    
    
    _model = model;
    
    [_Pictureimage sd_setImageWithURL:[NSURL URLWithString:_model.picUrl]];
    
    _typelabel.text = _model.name;
    
    _Comelabel.text = _model.desc;
    
    if (model.listenCount > 10000) {
        NSString *time = [NSString stringWithFormat:@"%0.0f%@", model.listenCount / 1000 * 0.1,  @"万"];
        _Hearlabel.text = time;
    } else {
        _Hearlabel.text = [NSString stringWithFormat:@"%ld",model.listenCount];
    }
    
    
}

- (void)setSongModel:(HZJSongModel *)songModel {
    
    _songModel = songModel;
    
    [_Pictureimage sd_setImageWithURL:[NSURL URLWithString:songModel.pic_url]];
    _typelabel.text = songModel.title;
    
    _authorLable.text = songModel.author;
    
    if (songModel.listen_count.intValue >10000) {
        NSString *time = [NSString stringWithFormat:@"%0.1f%@", songModel.listen_count.intValue / 1000 * 0.1,  @"万"];
        _Hearlabel.text = time;
    } else {
        _Hearlabel.text = [NSString stringWithFormat:@"%d",songModel.listen_count.intValue];
    }
    
}

@end












